Advanced Topics


Resource Files

When creating an installer application, the Builder merges resources from a number of files. These include the selected installer template, the selected language file, and any XRays referenced within the script. The Builder will actually look for and merge resources from one more place: a script resource file.

A script resource file is a file containing extra resources needed in the final installer. The file must be named the same as the script document with a ".rsrc" extension. For example, if your script file is named "Advantage Script", the Builder will copy resources from a file named "Advantage Script.rsrc".

A script resource file has several uses. It can be used to copy resources needed by a particular XRay. For example, the PlaySound XRay requires a resource of type 'snd ' to be present in the final installer. You could simply copy your 'snd ' resource into the PlaySound XRay file and it would be copied into the installer when the XRay file is merged. A better approach would be to put the 'snd ' resource into a script resource file so that it would be copied only when you built an installer from the script that uses the sound.

Another use for a script resource file is to overwrite the default resources that are part of installer or language templates. Since the script resource file is the last file to be merged, any duplicate resources will overwrite the previously merged resources. You could use this approach to overwrite the default installation icon set each time you built an installer.

To create and modify a script resource file, you need a resource editing tool like ResEdit or Resorceror. ResEdit is available from Apple Computer and can be downloaded from the following URL:

http://cgi.info.apple.com/cgi-bin/lister-pl?Apple.Support.Area/Developer_Services/Tool_Chest/Developer_Utilities

Resorceror is a commercial resource editing tool available from Mathemaesthetics, Inc. (resorceror@aol.com)

Localization

DragInstall's use of language files makes localization easy. Language files contain only those resources from the installer application that need to be translated. DragInstall ships with a number of language files (found inside DragInstall Templates:Drag & Drop:Languages:), including: Localizing your installer for one of these languages involves two steps. The first is to build your installer with the appropriate language file selected in the Build Options dialog. The second is to localize any resources that are created from text that you've entered into your script, including the following:
Help text for Installations
This text is written to a resource of type åèLpsπ and ID 32015.
Message text and button names from Message Items
These items are written to the final installer in resources of type åXParπ with IDs that vary depending on the number and type of items in your installer.
Parameters to XRays that require translating
These items are written to the final installer in resources of type åXParπ with IDs that vary depending on the number and type of items in your installer.
Localizing your installer for a language not included in DragInstall's Languages folder involves one additional step. Before anything else, you must create a language file for the new language. This can be done by duplicating an existing language file, renaming it to the new language, and translating all of its resources. If the new language file is within the correct folder (i.e. "Languages") and is of the correct file type and creator (D2gt/Drg2), the new language will appear in the Build Options dialog. Most of the resources in the language files are ones that usually require localization (i.e. 'ALRT', 'DITL', 'STR#'). Some resource types require special attention. These include:
CNTL
The titles of these "control" resources need to be translated. They are the default names of the picture buttons in the main installer window.
Font
These font name resources only need to be changed for international systems where the default fonts are non-standard, i.e. "Osaka" in the Kanji system.
PICT
The names of the "picture" resources need to be translated. They are the names of the picture buttons in the main installer window. These names must match the titles of the CNTL resources.

Dynamic Localization

DragInstall has a feature that allows it to automatically change its interface based on the current language on the user's system. To enable this feature, you need to copy the "Languages" folder and its entire contents (or just those language files you need) from the "DragInstall Templates" folder onto the disk containing your first installer segment. If you are distributing your installer application on floppy disks, you must set the Extra space on first disk in the Build Options dialog when you build to leave enough space for the Languages folder. When an installer application launches, it checks for a folder named "Languages" within the same folder. If this folder is found, the installer gets the region code of the user's system. This region code is then mapped to a language name using the entries in a resource of type 'STRm' with ID 32001. If a file with this language name is found in the Languages folder, its resources replace those built into the installer application. This changes the installer's interface to display the appropriate language.

With dynamic localization, you can distribute one installer for multiple languages. You can also take advantage of the Language XRay to install individual items based on language.

Customizing Installers

This section discusses some options to customize your installer application beyond the options available within the Builder.

Changing Disk Names
When an installer application is created, the segments are named with the name of the first segment with a number appended (ex. "My Installer 3"). These are the names that the user sees when prompted to enter a disk. If you wish to change these names to something else (i.e. "Disk 1", "Disk 2", etc.), you can add a special disk names resource to your installer application.

This resource must be of type 'STR#" and have an ID of 32201. The resource does not need a name, but it must have its 'preload' attribute set. There needs to be enough strings in the 'STR#' to cover the number of segments in your installer application. If there are not enough strings, the segment name is used. Extra strings are ignored. To avoid having to add the disk names resource each time you build an installer application, you can create a script resource file with the resource. This file (named the same as the script with a ".rsrc" extension) would be copied into the installer application during the build.

Saving Disk Space
If you build an installer and find that the last segment is very small, you may be able to make some changes to eliminate that last segment. The following steps can be tried to save space. You must rebuild your installer for each step that you try.
Trim the size of your files
You may be able to save enough space by shortening or eliminating files included in your installer.
Make your startup screen smaller
Eliminating color from your startup screen or using PICT instead of Paint graphics can save a surprising amount of space in the installer.
Shorten or eliminate your read me text
Each character removed from your read me text is a character saved in the final installer.
Eliminate color icons from the installer template
This step will save a small amount, but it may be enough. Remember to make a backup of the template file before removing the color icon resources (icl4, icl8, ics4, ics8).
Use a custom segment size
The default settings for segment size, 780K and 1390K, provide for some extra space on a double-sided and high density disk. You can raise these numbers slightly to use more of the disk's capacity, but be careful about making a disk "too full."

Scripting

Installer applications created with DragInstall 2.0 support AppleEvents and scripting. Installers "understand" the standard DoScript event and a custom Install event.

The following excerpt from the installer's scripting dictionary provides a summary of DragInstall's scripting support.

do script: execute text as script
	do script  string  -- install "" [in ""]
	Result:   small integer  -- error code (0 == no error)

install: Perform an installation
	install  string  -- ""|recommended package
		[on  string]  -- ""|startup disk
		[in  string]  -- ""|installer folder
	Result:   small integer  -- error code (0 == no error)
For further details and examples, you can check out the DragInstall Scripting Kit. The DragInstall Scripting Kit is available at no charge. To receive this kit, you can contact Ray Sauers Associates directly or download it from the DragInstall web site at

http://www.sauers.com/draginstall/scripting


[Contents | Contact Information]

Last modified 26-MAR-96
Copyright © 1996 Ray Sauers Associates, Inc.